package SimuladoSun.Exame1;

public class NoGo implements Runnable {

	private static int i;

	public synchronized  void run() {

		System.out.println("Thread: " + Thread.currentThread().getName());
		if (i % 10 != 0) {
			i++;
		}
		for (int x = 0; x < 10; x++, i++) {
			if (x == 4)
				Thread.yield();
		}
		System.out.println("i=" + i + " ");
	}

	public static void main(String[] args) {
		NoGo n = new NoGo();
		for (int x = 0; x < 101; x++) {
			String nome = String.valueOf(x);
			new Thread(n,nome).start();
			//System.out.print("i >>>>> " + i + " ");
		}

	}

}
